﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using nHydrate.Dsl;

namespace nHydrate.DslPackage
{
	partial class nHydrateClipboardCommandSet
	{
		protected override void OnMenuCopy(object sender, EventArgs args)
		{
			base.OnMenuCopy(sender, args);
		}

		protected override void OnStatusPaste(object sender, EventArgs args)
		{
			base.OnStatusPaste(sender, args);
		}

		protected override void OnMenuPaste(object sender, global::System.EventArgs args)
		{
			nHydrateModel model = null;
			try
			{
				nHydrateDiagram diagram = null;
				foreach (var item in this.CurrentSelection)
				{
					if (diagram == null)
						diagram = item as nHydrateDiagram;
				}

				if (diagram != null)
				{
					model = diagram.ModelElement as nHydrateModel;
					model.IsLoading = true;
				}

				base.OnMenuPaste(sender, args);

			}
			catch (Exception ex)
			{
				throw;
			}
			finally
			{
				if (model != null)
					model.IsLoading = false;
			}

		}
	}
}
